package com.zhj.leetcode;

/**
 * 力扣 70 爬楼梯
 * 每次可以爬1步或者两步，有多少种方式爬到楼顶
 */
public class Test70 {
    public static void main(String[] args) {
        System.out.println(climbStairs(2));
    }

    public static int climbStairs(int n) {
        int p = 0, q = 0, r = 1;
        for (int i = 1; i <= n; i++) {
            p = q;
            q = r;
            r = p + q;
        }
        return r;
    }
}
